package com.weiyi.mashangzhu.Utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by win7 on 2017/6/15.
 */

public class IsEmailNO {

    public static boolean checkEmail(String email){
        boolean flag = false;
        try{
            String check = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
            Pattern regex = Pattern.compile(check);
            Matcher matcher = regex.matcher(email);
            flag = matcher.matches();
        }catch(Exception e){
            flag = false;
        }
        return flag;
    }
    public static boolean checkQQ(String qq){
        boolean flag = false;
        String regex = "[1-9][0-9]{4,14}";//第一位1-9之间的数字，第二位0-9之间的数字，数字范围4-14个之间
        //String regex2 = "[1-9]\\d{4,14}";//此句也可以
         flag = qq.matches(regex);
        return flag;
    }
}
